<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <style>
        .grandpa {
            width: 300px;
            height: 300px;
            background-color: gold;
        }

        .father {
            width: 200px;
            height: 200px;
            background-color: red;
        }

        .son {
            width: 100px;
            height: 100px;
            background-color: blue;
        }
    </style>
    <script src="./js/jquery-1.12.4.min.js"></script>
    <script>
        $(function () {
            // 事件冒泡 会往父级传递事件

            $(".grandpa").click(function (event) {
                console.log("grandpa");
            });

            $(".father").click(function (event) {
                console.log("father");
                // event.stopPropagation();//阻止事件的传递

                return false;
            });

            $(".son").click(function (event) {
                console.log("son");
                // event.stopPropagation();//阻止事件的传递


                return false;
            });


        });
    </script>
</head>

<body>

    <div class="grandpa">
        <div class="father">
            <div class="son"></div>
        </div>
    </div>


</body>

</html>